<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo ($title); ?></title>
</head>
<script src="/Public/js/jquery-1.10.1.min.js"></script>
<body>
<div>
    <input type="submit" value="点击获取数据" id="getajax" onclick="getAjaxData('content',this);">
    <div id="putId"></div>
</div>
</body>
<script type="text/javascript">
    var index=1;
        $(document)
            .ajaxStart(function(){
                $("#getajax").attr("disabled", true);

            })
            .ajaxStop(function(){
                $("#getajax").attr("disabled", false);
            }
            );
    $("body").on('click','#getajax',function () {
        function getAjaxData(putId,dom) {
            $.ajax({
                url:"<?php echo U('');?>",
                dataType:"json",
                type:"post",
                data:{page:index},
                success:function (data) {
                    console.log(index);
                    index++;
//                $('#putId').empty();   //清空resText里面的所有内容
                    var html = '';
                    if (data){
                        $.each(data, function(commentIndex, comment){
                            html += '<div class="comment"><h6>' + comment['good_name']
                                + ':</h6><p class="para"' + comment['good_bianma']
                                + '</p></div>';
                        });
                        $('#putId').append(html);
                    }
                }
            })
        }
</script>
</html>